package com.example.springbolgdemo.common.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtils {

    //通过重写getter方法使用
    public static String format(LocalDateTime localDateTime){
        DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return dateTimeFormatter.format(localDateTime);
    }

    public static String format(LocalDateTime localDateTime,String pattern){
        DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern(pattern);
        return dateTimeFormatter.format(localDateTime);
    }

}
